@echo off

set MSBuildPath=%SYSTEMROOT%\Microsoft.NET\Framework\v3.5
set CPUCount=1
set MSBuildArgs=/t:Build  /v:q /nologo /m:%CPUCount%

@echo =========================================================================
@echo Starting build.......
@echo MSBuildArgs args: %MSBuildArgs%

echo ---------------------- Build Start -------------------

%MSBuildPath%\MSBuild.exe Brunch.csproj  %MSBuildArgs%

set BUILD_STATUS=%ERRORLEVEL%
if not %BUILD_STATUS%==0  goto OnError

echo ---------------------- Build End ----------------


@echo Build succeeded!
@echo =========================================================================

goto OnEnd

:OnError
echo ----------------------------------------------------------------------
echo Error! Please check the log and call for another build.
echo ----------------------------------------------------------------------


:OnEnd
@if "%1" == "automate" goto continue
pause

:continue